using System;
using System.Collections.Generic;
using System.Text;
using My.IdlConverter.Core;
using My.IdlConverter.Core.Producers;
using My.IdlConverter.Core.Types;

namespace My.IdlConverter.Com
{
    class ComParameterProducer : ParameterProducer
    {
        public ComParameterProducer()
        {
        }
        public ComParameterProducer(Parameter consumer)
            : base(consumer)
        {
        }

        public override string Produce()
        {
            string prefix = "";
            if (Consumer.Attribute == ParamAttribute.Out)
            {
                prefix = "[out]";
            }
            else if (Consumer.Attribute == ParamAttribute.In)
            {
                prefix = "[in]";
            }
            else if (Consumer.Attribute == ParamAttribute.InOut)
            {
                prefix = "[in,out]";
            }

            ITypeFormatter typeFormatter = new TypeFormatter(Consumer.Type,
                TypeFormatStrategyFactory.Create(TypeFormatStrategyFactory.ParameterType));
            return prefix + typeFormatter.Format() + " " + Consumer.Name;
        }
    }
}
